package com.hx.er.action.admin.rest;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.hx.er.action.base.ErAdminPageAction;
import com.hx.er.bean.base.RestraurantBean;
import com.hx.er.common.util.StringUtil;
import com.hx.er.service.admin.IAdminRestService;

public class AdminRestListAction extends ErAdminPageAction {
	// 序列化ID
	private static final long serialVersionUID = -7598981155691682472L;

	private List<RestraurantBean> restList;
	private int restCount;
	private String restName;
	private String serverNamePage;

	@Autowired
	private IAdminRestService adminRestListService;

	public String init() {
		// 基本检索条件获取
		Map<String, Object> conditions = super.getConditionMap();

		// 检索条件
		conditions.put("restName", StringUtil.EmptyToNull(StringUtil.trim(this.restName)));
		conditions.put("serverName", StringUtil.EmptyToNull(StringUtil.trim(this.serverNamePage)));

		// 查询列表
		this.restList = this.adminRestListService.getRestList(conditions);
		// 查询用户总数
		this.restCount = this.adminRestListService.getRestCount(conditions);
		super.pageCount = (int) Math.ceil(this.restCount / (double) super.dataListLimit);

		return SUCCESS;
	}

	public List<RestraurantBean> getRestList() {
		return restList;
	}

	public void setRestList(List<RestraurantBean> restList) {
		this.restList = restList;
	}

	public int getRestCount() {
		return restCount;
	}

	public void setRestCount(int restCount) {
		this.restCount = restCount;
	}

	public String getRestName() {
		return restName;
	}

	public void setRestName(String restName) {
		this.restName = restName;
	}

	public String getServerNamePage() {
		return serverNamePage;
	}

	public void setServerNamePage(String serverNamePage) {
		this.serverNamePage = serverNamePage;
	}

}
